Assignemnt #74 and 72th program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: 72th Program
///File name: Sev2Prog.java
///Date Finished:12/7/2015
import java.util.Scanner;
import java.util.Random;
public class Sev2Prog
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int number;
double root;
System.out.println( "SQUARE ROOT!" );
System.out.print( "Enter a number: " );
number = keyboard.nextInt();
do{
root = Math.sqrt(number);
System.out.println( "The square root of " + number + " is " + root + "." );
}while(number < 0);
}
}
Picture of the output